<!DOCTYPE html>
<html>
  <head>
    <!--META-->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.75">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">

    <!--CSS-->
    <link rel="stylesheet" href="API/css/themes/default/jquery.mobile.min.css" />
    <link rel="stylesheet" href="API/css/themes/default/jquery.mobile.structure.min.css" />
    <link rel="stylesheet" href="API/css/themes/default/jquery.mobile.theme.min.css" />
    <link rel="stylesheet" href="API/css/mycss.css" />
    <link rel="stylesheet" href="API_RH/css/mycss.css" />
    <link rel="stylesheet" href="css/mycss.css" />

    <!--JS-->
    <script type="text/javascript" src="API/js/jquery.min.js"></script>
    <script type="text/javascript" src="API/js/jquery.mobile.min.js"></script>
    <!--<script type="text/javascript" src="API/js/highcharts.js"></script>-->
    <!--<script type="text/javascript" src="API/js/modules/exporting.js"></script>-->
    <!--<script type="text/javascript" src="API/js/jquery.dataTables.min.js"></script>--> 
    <script type="text/javascript" src="include/config.js"></script>
    <script type="text/javascript" src="API/js/fonctions.js"></script>
    <script type="text/javascript" src="API_RH/js/fonctions.js"></script>
    <script type="text/javascript" src="js/fonctions.js"></script>
	
    <script language="javascript" type="text/javascript">
    checkMaintenance();
    checkAuthentification();
	
		///////////////////
		//BLOCK VARIABLE GLOBAL
		///////////////////
		var id_page = 15;
		
	
		///////////////////
		//BLOCK FONCTIONS EVENEMENTS
		///////////////////
        
		$(document).on('pageinit',function() {
		    try {
		        // Init commun
				init_commun();

				// Init page
				var currentTime = new Date();
				var annee = currentTime.getFullYear();
				var mois = pad2(currentTime.getMonth()+1);
				var strDate = "01/" + mois + "/" + annee;
				
				afficheOutSLAMonth(strDate);
				afficheOutSLAMonthP3P4(strDate);
            }
            catch (er) {
                log(0, "ERROR(init_rapports_SLA):" + er.message);
            }
        });
		
		$(document).on('pageshow',function() {
			try {
				show_commun();
			}
			catch (er) {
				log(0, "ERROR(show):" + er.message);
			}
		});
		
		///////////////////
		//BLOCK FONCTIONS METIER
		///////////////////
		
		function afficheOutSLAMonth(p_strDate) {
            try {
                var tabOutSLAMonth = new Array();
                tabOutSLAMonth = getOutSLAMonth(p_strDate);

                innerHtmlOutSLAMonth = getHTMLOutSLAMonth(tabOutSLAMonth);

                divOutSLAMonth.innerHTML = innerHtmlOutSLAMonth;
            }
            catch (er) {
                log(0, "ERROR(afficheOutSLAMonth):" + er.message);
            }
        }
		
		function afficheOutSLAMonthP3P4(p_strDate) {
            try {
                var tabOutSLAMonthP3P4 = new Array();
                tabOutSLAMonthP3P4 = getOutSLAMonthP3P4(p_strDate);

                innerHtmlOutSLAMonthP3P4 = getHTMLOutSLAMonthP3P4(tabOutSLAMonthP3P4);

                divOutSLAMonthP3P4.innerHTML = innerHtmlOutSLAMonthP3P4;
            }
            catch (er) {
                log(0, "ERROR(afficheOutSLAMonth):" + er.message);
            }
        }
		
		///////////////////
		//BLOCK FONCTIONS BD
		///////////////////
		
		function getOutSLAMonth(p_strDate) {
            try {
                var strResponse = "";
                var returns = new Array();
                var tempTab = new Array();
                var tempSubTab = new Array();

                xhr_object = new AJ();

                var url = "phpsql/mysql_getOutSLAMonth_custo.php?milis="+getMilise()+"&strDate="+p_strDate+"&crtl=ok";

                xhr_object.open("GET", url, false);
                xhr_object.send(null);
                if (xhr_object.readyState == 4) {
                    strResponse = xhr_object.responseText;
                } else {
                    strResponse = "ERROR";
                }

                tempTab = strResponse.split("\n");

                for (var indice in tempTab) {
                    tempSubTab = tempTab[indice].split("&");
                    if (tempSubTab.length > 1) {
                        returns[returns.length] = tempSubTab.slice(0, tempSubTab.length - 1);
                    }
                }

                delete xhr_object;

                return returns;
            }
            catch (er) {
                log(0, "ERROR(getOutSLAMonth):" + er.message);
            }
        }
		
		function getOutSLAMonthP3P4(p_strDate) {
            try {
                var strResponse = "";
                var returns = new Array();
                var tempTab = new Array();
                var tempSubTab = new Array();

                xhr_object = new AJ();

                var url = "phpsql/mysql_getOutSLAMonthP3P4_custo.php?milis="+getMilise()+"&strDate="+p_strDate+"&crtl=ok";

                xhr_object.open("GET", url, false);
                xhr_object.send(null);
                if (xhr_object.readyState == 4) {
                    strResponse = xhr_object.responseText;
                } else {
                    strResponse = "ERROR";
                }

                tempTab = strResponse.split("\n");

                for (var indice in tempTab) {
                    tempSubTab = tempTab[indice].split("&");
                    if (tempSubTab.length > 1) {
                        returns[returns.length] = tempSubTab.slice(0, tempSubTab.length - 1);
                    }
                }

                delete xhr_object;

                return returns;
            }
            catch (er) {
                log(0, "ERROR(getOutSLAMonthP3P4):" + er.message);
            }
        }
		
		///////////////////
		//BLOCK FONCTIONS AFFICHAGE
		///////////////////
		
		function getHTMLOutSLAMonth(tabOutSLAMonth) {
            try {
                var strRetour = "";
                
                strRetour += "<table BORDER=\"1\" style=\"font-size:14px;background-color:white;text-shadow: none;\">";
                strRetour += "<TR>";
                strRetour += "<TH> <a href=\"#\" title=\"Nom ticket\">Nom ticket</a></TH>";
                strRetour += "<TH> <a href=\"#\" title=\"Priorit&eacute;\">Priorit&eacute;</a></TH>";
                strRetour += "<TH> <a href=\"#\" title=\"Responsable\">Responsable</a></TH>";
                strRetour += "<TH> <a href=\"#\" title=\"Date cr&eacute;ation\">Date cr&eacute;ation</a></TH>";
                strRetour += "<TH> <a href=\"#\" title=\"Date de fermeture\">Date fermeture</a></TH>";
                strRetour += "<TH> <a href=\"#\" title=\"Libell&eacute;\">Libell&eacute;</a></TH>";
                strRetour += "<TH> <a href=\"#\" title=\"Dur&eacute;e\">Dur&eacute;e</a></TH>";
                strRetour += "</TR>";

                for (var indice in tabOutSLAMonth) {
                    strRetour += "<TR>";
                    strRetour += "<TD >&nbsp;<a target=\"_new\" href=\"http://10.197.68.30:4000/AutoDiseWeb/automate/popupModule.jsp?modType=SIG_SIG&modCode=" + tabOutSLAMonth[indice][0] + "\">" + tabOutSLAMonth[indice][0] + "</a> </TD>";
                    strRetour += "<TD >&nbsp;" + tabOutSLAMonth[indice][1] + " </TD>";
                    strRetour += "<TD >&nbsp;" + tabOutSLAMonth[indice][2] + " </TD>";
                    strRetour += "<TD >&nbsp;" + tabOutSLAMonth[indice][3] + " </TD>";
                    strRetour += "<TD >&nbsp;" + tabOutSLAMonth[indice][4] + " </TD>";
                    strRetour += "<TD style=\"width: 400px;\" >&nbsp;" + tabOutSLAMonth[indice][5] + " </TD>";
                    strRetour += "<TD >&nbsp;" + strMinInHeureMin(tabOutSLAMonth[indice][6]) + " </TD>";
                    strRetour += "</TR>";
                }

                strRetour += "</table>";
				strRetour += "<br>";
				strRetour += "<br>";

                return strRetour;
            }
            catch (er) {
                log(0, "ERROR(getHTMLOutSLAMonth):" + er.message);
            }
        }
		
		function getHTMLOutSLAMonthP3P4(tabOutSLAMonthP3P4) {
            try {
                var strRetour = "";
                
                strRetour += "<table BORDER=\"1\" style=\"font-size:14px;background-color:white;text-shadow: none;\">";
                strRetour += "<TR>";
                strRetour += "<TH> <a href=\"#\" title=\"Nom ticket\">Nom ticket</a></TH>";
                strRetour += "<TH> <a href=\"#\" title=\"Priorit&eacute;\">Priorit&eacute;</a></TH>";
                strRetour += "<TH> <a href=\"#\" title=\"Responsable\">Responsable</a></TH>";
                strRetour += "<TH> <a href=\"#\" title=\"Date cr&eacute;ation\">Date cr&eacute;ation</a></TH>";
                strRetour += "<TH> <a href=\"#\" title=\"Date de fermeture\">Date fermeture</a></TH>";
                strRetour += "<TH> <a href=\"#\" title=\"Libell&eacute;\">Libell&eacute;</a></TH>";
                strRetour += "<TH> <a href=\"#\" title=\"Dur&eacute;e\">Dur&eacute;e</a></TH>";
                strRetour += "</TR>";

                for (var indice in tabOutSLAMonthP3P4) {
                    strRetour += "<TR>";
                    strRetour += "<TD >&nbsp;<a target=\"_new\" href=\"http://10.197.68.30:4000/AutoDiseWeb/automate/popupModule.jsp?modType=SIG_SIG&modCode=" + tabOutSLAMonthP3P4[indice][0] + "\">" + tabOutSLAMonthP3P4[indice][0] + "</a> </TD>";
                    strRetour += "<TD >&nbsp;" + tabOutSLAMonthP3P4[indice][1] + " </TD>";
                    strRetour += "<TD >&nbsp;" + tabOutSLAMonthP3P4[indice][2] + " </TD>";
                    strRetour += "<TD >&nbsp;" + tabOutSLAMonthP3P4[indice][3] + " </TD>";
                    strRetour += "<TD >&nbsp;" + tabOutSLAMonthP3P4[indice][4] + " </TD>";
                    strRetour += "<TD style=\"width: 400px;\" >&nbsp;" + tabOutSLAMonthP3P4[indice][5] + " </TD>";
                    strRetour += "<TD >&nbsp;" + strMinInHeureMin(tabOutSLAMonthP3P4[indice][6]) + " </TD>";
                    strRetour += "</TR>";
                }

                strRetour += "</table>";
				strRetour += "<br>";
				strRetour += "<br>";

                return strRetour;
            }
            catch (er) {
                log(0, "ERROR(getHTMLOutSLAMonthP3P4):" + er.message);
            }
        }
    </script>
	
  </head>
  <body>
    
	<!-- page -->
	<div data-role="page" data-title="Titre">
	
		<!-- /panel -->
		<div data-role="panel" id="mypanel" data-display="overlay" data-position="left">

		</div>
		<!-- /panel -->
	
		<!-- header -->
		<div data-role="header" data-position="fixed">
			<a href="#mypanel" data-role="button" data-icon="home" data-iconpos="notext">home</a>
			<h1 id="id_titre">titre</h1>
			<a href="javascript:window.location = ('./page_contact.html?mili='+getMilise());" data-role="button" data-icon="info" data-iconpos="notext">Contact</a>
		</div>
		<!-- /header -->

		<!-- content -->
		<div data-role="content" id="main_content">
		
			<div data-role="collapsible" data-collapsed="false" data-mini="true">
				<h3>R&eacute;capitulatif</h3>
				<p class="sansserif">Liste des tickets P1 & P2 qui ont &eacute;t&eacute; ferm&eacute; ce mois et avec leur SLA d&eacute;pass&eacute; : </p>
				<div id="divOutSLAMonth">Pas de r&eacute;sultat.</div>
				<p class="sansserif">Liste des tickets P3 & P4 qui ont &eacute;t&eacute; ferm&eacute; ce mois et avec leur SLA d&eacute;pass&eacute; : </p>
				<div id="divOutSLAMonthP3P4">Pas de r&eacute;sultat.</div>
			</div>
			
		</div>
		<!-- /content -->
		
		<!-- footer -->
		<div data-role="footer" data-position="fixed">
			<a data-role="button" data-icon="search" data-iconpos="notext" class="ui-btn-left" href="javascript:window.location = ('./page_faq.html?mili='+getMilise());">FAQ</a>
			<h1 id="id_affichageUser">User</h1>
			<a data-role="button" data-icon="delete" data-iconpos="notext" class="ui-btn-right" href="javascript:window.location = ('./page_sortie.html?mili='+getMilise());">Logout</a>
		</div>
		<!-- /footer -->
		
	</div>
	<!-- /page -->
</body>
</html>